﻿CREATE PROCEDURE [dbo].[proc_Employee_WageSeries_Create]
	(
		@WSId uniqueidentifier,
		@Num nvarchar(50),
		@Title nvarchar(50),
		@CompanyList nvarchar(500)
	)
AS
	Begin
		Insert Into Employee_WageSeries(WSId,Num,Title) Values(@WSId,@Num,@Title)
		Declare @i int
		Set @i=0
		while(@i<len(@CompanyList))
			Begin
				Insert Into Employee_WageSeries_Company(CompanyId,WSId) Values(substring(@CompanyList,@i,charindex(',',@CompanyList,@i)-@i),@WSId)
				Set @i=charindex(',',@CompanyList,@i)+1
			End
	End
	RETURN
